package kn.tool.file;

import lombok.extern.slf4j.Slf4j;
/*import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;*/

/**
 * Description: 文件http上传，参考：https://blog.csdn.net/gnail_oug/article/details/80324120
 */

/*@RestController
@RequestMapping("/common/file")*/
@Slf4j
public class FileHttpUploadControllerDemo {
    /**
     * 文件上传，文件名：file
     * @param file 上传文件对象
     * @return
     * @throws KnException
     *//*
    @PostMapping("/upload")
    @ResponseStatus(HttpStatus.OK)
    public Object fileUpload(@RequestParam("file") MultipartFile file) throws KnException {
        if (file.isEmpty()) {
            log.error(">> 上传文件失败，请先选择文件！");
            throw new KnException("上传文件失败，请先选择文件！");
        }

        // 处理文件
        String fileName = file.getOriginalFilename();
        log.info(">> 上传文件名称：{}", fileName);
        log.info(">> 上传文件大小[单位：KB]：{}", file.getSize() / 1024);

        return WebSofeResponse.ok("上传成功！", fileName);
    }*/
}
